//定义新闻组件
var News = React.createClass({
    //定义状态数据
    getInitialState:function () {
        return{
            list : ['阿斯顿撒所的','撒打算娲皇宫i','哦哦我让你爱上了贷款啊']
        }
    },
    createList:function () {
      return this.state.list.map(function (value,index) {
            return<li key={index}>{value}</li>
      })
    },
    render:function () {
        return(
            <ul>
                {this.createList()}
            </ul>
        )
    },
    //用jQuery更新样式
    componentDidMount:function () {
        var me = this;
        $('li').css('background','green')
        //4秒钟之后变成5条新闻
        setTimeout(function () {
            me.setState({
               list : [
                   '12314',
                   '124366812',
                   '875478123',
                   '12465478h',
                   '898954820dhhd'
               ]
            })
        },4000)
    },
    //组件更新完毕，再次更新
    componentDidUpdate:function () {
        $('li').css('background','green')
    }
})
ReactDOM.render(<News></News>,document.getElementById('app'))